home *** CD-ROM | disk | FTP | other *** search
- {
- [Scriptsettings]
- Scriptname=Quick Table
- ExecuteOnStartup=0
- ExecuteOnlyOnce=0
- }
-
- program QuickTable;
- var
- Column, Row: integer;
- LblCaption: TLabel;
- F: TForm;
-
- procedure GridMouseClick(Sender: TObject);
- var
- i,j: integer;
- Code:string;
- begin
- Code := '<table>'+#13#10;
- for I := 0 to Row do
- begin
- Code := Code + #9+'<tr>'+#13#10;
- for J:= 0 to Column do
- begin
- Code := Code + #9#9+'<td></td>'+#13#10;
- end;
- Code := Code + #9'</tr>'+#13#10;
- end;
- Code := Code + '</table>';
- InsertTags(Code, '');
- F.Close;
- end;
-
- procedure GridMouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer);
- var
- Grid: TStringGrid;
- myRect: TGridRect;
- begin
- Grid := (Sender as TStringGrid);
- try
- Grid.MouseToCell(X, Y, Column, Row);
- myRect := Grid.Selection;
- myRect.Left := 0;
- myRect.Right := Column;
- myRect.Top := 0;
- myRect.Bottom := Row;
- Grid.Selection := myRect;
-
- If Column + 1 = Grid.ColCount - 1 then
- begin
- Grid.ColCount := Grid.ColCount+1;
- Grid.Width := Grid.Width + 23;
- F.Width := F.Width + 25;
- end;
- If Row + 1 = Grid.RowCount - 1 then
- begin
- Grid.RowCount := Grid.RowCount+1;
- Grid.Height := Grid.Height + 23;
- F.Height := F.Height + 25;
- end;
- LblCaption.Caption := (IntToStr(Column+1)) + ' x ' + (IntToStr(Row+1)+' table');
- except
- exit;
- end;
- end;
-
- var
- SG: TStringGrid;
- begin
- F := TForm.Create(nil);
- F.Caption := 'QuickTable';
- F.BorderStyle := bsToolWindow;
- SG := TStringGrid.Create(F);
- SG.Parent := F;
- SG.Align := alClient;
- SG.FixedCols := 0;
- SG.FixedRows := 0;
- SG.DefaultRowHeight := 24;
- SG.DefaultColWidth := 24;
- SG.RowCount := 5;
- SG.ColCount := 5;
- SG.Options := SetOf([goFixedVertLine, goFixedHorzLine, goVertLine, goHorzLine, goRangeSelect, goDrawFocusSelected, goAlwaysShowEditor]);
- SG.OnMouseMove := 'GridMouseMove';
- SG.OnClick := 'GridMouseClick';
- F.ClientWidth := 130;
- F.ClientHeight := 150;
- LblCaption := TLabel.Create(F);
- LblCaption.Parent := F;
- LblCaption.Align := alBottom;
- F.ShowModal;
- F.Release;
- end;
-